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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue (-1 / +60 lines)
Lines 16-21 import "datatables.net-buttons" Link Here
16
import "datatables.net-buttons/js/buttons.html5"
16
import "datatables.net-buttons/js/buttons.html5"
17
import "datatables.net-buttons/js/buttons.print"
17
import "datatables.net-buttons/js/buttons.print"
18
import "datatables.net-buttons/js/buttons.colVis"
18
import "datatables.net-buttons/js/buttons.colVis"
19
19
DataTable.use(DataTablesLib)
20
DataTable.use(DataTablesLib)
20
21
21
export default {
22
export default {
Lines 81-86 export default { Link Here
81
    },
82
    },
82
    beforeMount() {
83
    beforeMount() {
83
        if (this.actions.hasOwnProperty("-1")) {
84
        if (this.actions.hasOwnProperty("-1")) {
85
            if (this.searchable_additional_fields.length) {
86
                this.searchable_additional_fields.forEach(searchable_field => {
87
                    var _customRender = (function (searchable_field) {
88
                        var _render = function (data, type, row, meta) {
89
                            return row._strings.additional_field_values
90
                                .filter(
91
                                    field =>
92
                                        field.field_id == searchable_field.id
93
                                )
94
                                .map(el => el.value_str)
95
                        }
96
                        return _render
97
                    })(searchable_field)
98
99
                    this.tableColumns.push({
100
                        name: searchable_field.name,
101
                        data: "extended_attributes",
102
                        datatype: "related-object",
103
                        related: "extended_attributes",
104
                        relatedKey: "field_id",
105
                        relatedValue: searchable_field.id,
106
                        relatedSearchOn: "value",
107
                        className:
108
                            "searchable-additional-column-" +
109
                            searchable_field.id,
110
                        title: searchable_field.name,
111
                        searchable: true,
112
                        sortable: false,
113
                        render: _customRender,
114
                    })
115
116
                    if (searchable_field.authorised_value_category) {
117
                        let options =
118
                            this.searchable_av_options[
119
                                searchable_field.authorised_value_category
120
                            ]
121
122
                        options.map(e => {
123
                            e["_id"] = e["value"]
124
                            e["_str"] = e["label"]
125
                            return e
126
                        })
127
128
                        this.filters_options[this.tableColumns.length - 1] =
129
                            options
130
                    }
131
                })
132
            }
133
84
            this.tableColumns = [
134
            this.tableColumns = [
85
                ...this.tableColumns,
135
                ...this.tableColumns,
86
                {
136
                {
Lines 234-239 export default { Link Here
234
            type: Object,
284
            type: Object,
235
            required: false,
285
            required: false,
236
        },
286
        },
287
        searchable_additional_fields: {
288
            type: Array,
289
            required: false,
290
            default: [],
291
        },
292
        searchable_av_options: {
293
            type: Array,
294
            required: false,
295
            default: [],
296
        },
237
    },
297
    },
238
}
298
}
239
</script>
299
</script>
240
- 

Return to bug 35287