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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue (-1 / +62 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 ==
93
                                        searchable_field.extended_attribute_type_id
94
                                )
95
                                .map(el => el.value_str)
96
                        }
97
                        return _render
98
                    })(searchable_field)
99
100
                    this.tableColumns.push({
101
                        name: searchable_field.name,
102
                        data: "extended_attributes",
103
                        datatype: "related-object",
104
                        related: "extended_attributes",
105
                        relatedKey: "field_id",
106
                        relatedValue:
107
                            searchable_field.extended_attribute_type_id,
108
                        relatedSearchOn: "value",
109
                        className:
110
                            "searchable-additional-column-" +
111
                            searchable_field.extended_attribute_type_id,
112
                        title: searchable_field.name,
113
                        searchable: true,
114
                        sortable: false,
115
                        render: _customRender,
116
                    })
117
118
                    if (searchable_field.authorised_value_category_name) {
119
                        let options =
120
                            this.searchable_av_options[
121
                                searchable_field.authorised_value_category_name
122
                            ]
123
124
                        options.map(e => {
125
                            e["_id"] = e["value"]
126
                            e["_str"] = e["label"]
127
                            return e
128
                        })
129
130
                        this.filters_options[this.tableColumns.length - 1] =
131
                            options
132
                    }
133
                })
134
            }
135
84
            this.tableColumns = [
136
            this.tableColumns = [
85
                ...this.tableColumns,
137
                ...this.tableColumns,
86
                {
138
                {
Lines 242-247 export default { Link Here
242
            type: Object,
294
            type: Object,
243
            required: false,
295
            required: false,
244
        },
296
        },
297
        searchable_additional_fields: {
298
            type: Array,
299
            required: false,
300
            default: [],
301
        },
302
        searchable_av_options: {
303
            type: Array,
304
            required: false,
305
            default: [],
306
        },
245
    },
307
    },
246
}
308
}
247
</script>
309
</script>
248
- 

Return to bug 35287