Bug 33066: Embed vendor and retrieve vendor name from the request

Bug 33066: (follow-up) Embed vendor and retrieve vendor name from the request

It needs "Bug 32923: Allow to embed user_roles for agreements"

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>

Signed-off-by: Agustín Moyano <agustinmoyano@theke.io>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 922ed2d283)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2023-03-07 15:42:48 +01:00 committed by Martin Renvoize
parent a6d42b459e
commit 38e0aa865d
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
3 changed files with 4 additions and 7 deletions

View file

@ -68,6 +68,7 @@
type: string
enum:
- user_roles
- vendor
collectionFormat: csv
- $ref: "../swagger.yaml#/parameters/match"
- $ref: "../swagger.yaml#/parameters/order_by"

View file

@ -95,6 +95,7 @@ export default {
building_table: false,
tableOptions: {
columns: this.getTableColumns(),
options: { embed: "vendor" },
url: () => this.table_url(),
table_settings: this.agreement_table_settings,
add_filters: true,
@ -211,10 +212,6 @@ export default {
getTableColumns: function () {
let get_lib_from_av = this.get_lib_from_av
let escape_str = this.escape_str
let vendors_map = this.vendors.reduce((map, e) => {
map[e.id] = e
return map
}, {})
return [
{
@ -238,9 +235,7 @@ export default {
searchable: true,
orderable: true,
render: function (data, type, row, meta) {
return row.vendor_id != undefined
? row.vendor_id //escape_str(vendors_map[row.vendor_id].name)
: ""
return row.vendor_id != undefined ? row.vendor.name : ""
},
},
{

View file

@ -46,6 +46,7 @@ export default {
},
buttons,
default_search: this.$route.query.q,
...this.options,
},
hidden_ids,
included_ids,