Bug 38201: DRY out getTableColumns
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
bbd8f1c490
commit
c00992e0fe
|
|
@ -33,22 +33,35 @@ export default {
|
|||
|
||||
return {
|
||||
resourceAttrs: [
|
||||
{
|
||||
name: "record_source_id",
|
||||
required: true,
|
||||
type: "text",
|
||||
label: __("Id"),
|
||||
hideInForm: true,
|
||||
showInTable: {
|
||||
title: __("ID"),
|
||||
data: "record_source_id",
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
required: true,
|
||||
type: "text",
|
||||
label: __("Name"),
|
||||
showInTable: true,
|
||||
},
|
||||
{
|
||||
name: "can_be_edited",
|
||||
type: "checkbox",
|
||||
label: __("Can be edited"),
|
||||
value: false,
|
||||
showInTable: true,
|
||||
},
|
||||
],
|
||||
tableOptions: {
|
||||
options: { embed: "usage_count" },
|
||||
columns: this.getTableColumns(),
|
||||
url: this.getResourceTableUrl(),
|
||||
actions: {
|
||||
"-1": [
|
||||
|
|
@ -67,9 +80,6 @@ export default {
|
|||
};
|
||||
},
|
||||
methods: {
|
||||
tableUrl() {
|
||||
return this.getResourceTableUrl();
|
||||
},
|
||||
onSubmit(e, recordSourceToSave) {
|
||||
e.preventDefault();
|
||||
let response;
|
||||
|
|
@ -100,33 +110,6 @@ export default {
|
|||
);
|
||||
}
|
||||
},
|
||||
getTableColumns() {
|
||||
let escape_str = this.escape_str;
|
||||
|
||||
return [
|
||||
{
|
||||
title: __("ID"),
|
||||
data: "record_source_id",
|
||||
searchable: true,
|
||||
},
|
||||
{
|
||||
title: __("Name"),
|
||||
data: "name",
|
||||
searchable: true,
|
||||
},
|
||||
{
|
||||
title: __("Can be edited"),
|
||||
data: "can_be_edited",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
row.can_be_edited ? __("Yes") : __("No")
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
},
|
||||
name: "RecordSourcesResource",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -403,6 +403,107 @@ export default {
|
|||
return [...acc, groupInfo];
|
||||
}, []);
|
||||
},
|
||||
getTableColumns(resourceAttrs) {
|
||||
let get_lib_from_av = this.get_lib_from_av;
|
||||
let idAttr = this.idAttr;
|
||||
|
||||
const columns = resourceAttrs
|
||||
.filter(attr => attr.showInTable)
|
||||
.reduce((acc, attr, i) => {
|
||||
if (typeof attr.showInTable === "object") {
|
||||
acc.push(attr.showInTable);
|
||||
return acc;
|
||||
}
|
||||
if (i === 0) {
|
||||
acc.push({
|
||||
title: attr.label,
|
||||
data: `me.${attr.name}:me.${idAttr}`,
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
'<a role="button" class="show">' +
|
||||
escape_str(
|
||||
`${row[`${attr.name}`]} (#${row[`${idAttr}`]})`
|
||||
) +
|
||||
"</a>"
|
||||
);
|
||||
},
|
||||
});
|
||||
return acc;
|
||||
}
|
||||
if (attr.type === "vendor") {
|
||||
acc.push({
|
||||
title: attr.label,
|
||||
data: attr.name,
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return row.vendor_id != undefined
|
||||
? '<a href="/cgi-bin/koha/acquisition/vendors/' +
|
||||
row.vendor_id +
|
||||
'">' +
|
||||
escape_str(row.vendor.name) +
|
||||
"</a>"
|
||||
: "";
|
||||
},
|
||||
});
|
||||
return acc;
|
||||
}
|
||||
if (attr.type === "select" && attr.avCat) {
|
||||
acc.push({
|
||||
title: attr.label,
|
||||
data: attr.name,
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return get_lib_from_av(
|
||||
attr.avCat,
|
||||
row[`${attr.name}`]
|
||||
);
|
||||
},
|
||||
});
|
||||
return acc;
|
||||
}
|
||||
if (attr.type === "date") {
|
||||
acc.push({
|
||||
title: attr.label,
|
||||
data: attr.name,
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return $date(row[`${attr.name}`]);
|
||||
},
|
||||
});
|
||||
return acc;
|
||||
}
|
||||
if (attr.type === "boolean" || attr.type === "checkbox") {
|
||||
acc.push({
|
||||
title: attr.label,
|
||||
data: attr.name,
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
row[`${attr.name}`] ? __("Yes") : __("No")
|
||||
);
|
||||
},
|
||||
});
|
||||
return acc;
|
||||
}
|
||||
if (attr.showInTable) {
|
||||
acc.push({
|
||||
title: attr.label,
|
||||
data: attr.name,
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
});
|
||||
return acc;
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
return columns;
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
/**
|
||||
|
|
@ -467,6 +568,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.populateAttributesWithAuthorisedValues(this.resourceAttrs);
|
||||
this.tableOptions.columns = this.getTableColumns(this.resourceAttrs);
|
||||
},
|
||||
name: "BaseResource",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -67,19 +67,19 @@ export default {
|
|||
required: true,
|
||||
type: "text",
|
||||
label: __("Agreement name"),
|
||||
showInTable: true,
|
||||
},
|
||||
{
|
||||
name: "vendor_id",
|
||||
type: "vendor",
|
||||
label: __("Vendor"),
|
||||
showInTable: true,
|
||||
showElement: {
|
||||
type: "text",
|
||||
value: "vendor.name",
|
||||
link: {
|
||||
href: "/cgi-bin/koha/acqui/supplier.pl",
|
||||
params: {
|
||||
bookseller_id: "vendor_id",
|
||||
},
|
||||
href: "/cgi-bin/koha/acquisition/vendors",
|
||||
slug: "vendor_id",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -89,12 +89,14 @@ export default {
|
|||
textAreaRows: 10,
|
||||
textAreaCols: 50,
|
||||
label: __("Description"),
|
||||
showInTable: true,
|
||||
},
|
||||
{
|
||||
name: "status",
|
||||
required: true,
|
||||
type: "select",
|
||||
label: __("Status"),
|
||||
showInTable: true,
|
||||
avCat: "av_agreement_statuses",
|
||||
onSelected: resource => {
|
||||
if (resource.status !== "closed") {
|
||||
|
|
@ -107,6 +109,7 @@ export default {
|
|||
name: "closure_reason",
|
||||
type: "select",
|
||||
label: __("Closure reason"),
|
||||
showInTable: true,
|
||||
avCat: "av_agreement_closure_reasons",
|
||||
disabled: agreement => agreement.status !== "closed",
|
||||
},
|
||||
|
|
@ -114,11 +117,13 @@ export default {
|
|||
name: "is_perpetual",
|
||||
type: "boolean",
|
||||
label: __("Is perpetual"),
|
||||
showInTable: true,
|
||||
},
|
||||
{
|
||||
name: "renewal_priority",
|
||||
type: "select",
|
||||
label: __("Renewal priority"),
|
||||
showInTable: true,
|
||||
avCat: "av_agreement_renewal_priorities",
|
||||
},
|
||||
{
|
||||
|
|
@ -583,7 +588,6 @@ export default {
|
|||
},
|
||||
],
|
||||
tableOptions: {
|
||||
columns: this.getTableColumns(),
|
||||
options: {
|
||||
embed: "user_roles,vendor,extended_attributes,+strings",
|
||||
},
|
||||
|
|
@ -768,110 +772,6 @@ export default {
|
|||
);
|
||||
}
|
||||
},
|
||||
getTableColumns() {
|
||||
let get_lib_from_av = this.get_lib_from_av;
|
||||
let escape_str = this.escape_str;
|
||||
|
||||
return [
|
||||
{
|
||||
title: __("ID"),
|
||||
data: "me.agreement_id",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
'<a role="button" class="show">' +
|
||||
escape_str(`${row.agreement_id}`) +
|
||||
"</a>"
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Name"),
|
||||
data: "me.name:me.agreement_id",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
'<a role="button" class="show">' +
|
||||
escape_str(row.name) +
|
||||
"</a>"
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Vendor"),
|
||||
data: "vendor_id",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return row.vendor_id != undefined
|
||||
? '<a href="/cgi-bin/koha/acquisition/vendors/' +
|
||||
row.vendor_id +
|
||||
'">' +
|
||||
escape_str(row.vendor.name) +
|
||||
"</a>"
|
||||
: "";
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Description"),
|
||||
data: "description",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
},
|
||||
{
|
||||
title: __("Status"),
|
||||
data: "status",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
get_lib_from_av("av_agreement_statuses", row.status)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Closure reason"),
|
||||
data: "closure_reason",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
get_lib_from_av(
|
||||
"av_agreement_closure_reasons",
|
||||
row.closure_reason
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Is perpetual"),
|
||||
data: "is_perpetual",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
row.is_perpetual ? __("Yes") : __("No")
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Renewal priority"),
|
||||
data: "renewal_priority",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
get_lib_from_av(
|
||||
"av_agreement_renewal_priorities",
|
||||
row.renewal_priority
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
getTableFilters() {
|
||||
return [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
import BaseResource from "../BaseResource.vue";
|
||||
import { APIClient } from "../../fetch/api-client.js";
|
||||
import { inject } from "vue";
|
||||
import BaseResource from "../BaseResource.vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { APIClient } from "../../fetch/api-client.js";
|
||||
|
||||
export default {
|
||||
extends: BaseResource,
|
||||
|
|
@ -55,11 +53,13 @@ export default {
|
|||
required: true,
|
||||
type: "text",
|
||||
label: __("Package name"),
|
||||
showInTable: true,
|
||||
},
|
||||
{
|
||||
name: "vendor_id",
|
||||
type: "vendor",
|
||||
label: __("Vendor"),
|
||||
showInTable: true,
|
||||
showElement: {
|
||||
type: "text",
|
||||
value: "vendor.name",
|
||||
|
|
@ -73,19 +73,34 @@ export default {
|
|||
name: "package_type",
|
||||
type: "select",
|
||||
label: __("Type"),
|
||||
showInTable: true,
|
||||
avCat: "av_package_types",
|
||||
},
|
||||
{
|
||||
name: "content_type",
|
||||
type: "select",
|
||||
label: __("Content type"),
|
||||
showInTable: true,
|
||||
avCat: "av_package_content_types",
|
||||
},
|
||||
{
|
||||
name: "created_on",
|
||||
type: "date",
|
||||
label: __("Created on"),
|
||||
showInTable: true,
|
||||
hideInForm: true,
|
||||
showElement: {
|
||||
type: "text",
|
||||
value: "created_on",
|
||||
format: this.format_date,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "notes",
|
||||
required: false,
|
||||
type: "text",
|
||||
label: __("Notes"),
|
||||
showInTable: true,
|
||||
},
|
||||
{
|
||||
name: "additional_fields",
|
||||
|
|
@ -191,7 +206,6 @@ export default {
|
|||
},
|
||||
],
|
||||
tableOptions: {
|
||||
columns: this.getTableColumns(),
|
||||
url: this.getResourceTableUrl(),
|
||||
options: {
|
||||
embed: "resources+count,vendor.name,extended_attributes,+strings",
|
||||
|
|
@ -258,6 +272,7 @@ export default {
|
|||
delete erm_package.resources_count;
|
||||
delete erm_package.is_selected;
|
||||
delete erm_package._strings;
|
||||
delete erm_package.created_on;
|
||||
|
||||
erm_package.package_agreements = erm_package.package_agreements.map(
|
||||
({ package_id, agreement, ...keepAttrs }) => keepAttrs
|
||||
|
|
@ -285,86 +300,6 @@ export default {
|
|||
);
|
||||
}
|
||||
},
|
||||
getTableColumns() {
|
||||
let get_lib_from_av = this.get_lib_from_av;
|
||||
let escape_str = this.escape_str;
|
||||
return [
|
||||
{
|
||||
title: __("Name"),
|
||||
data: "me.name:me.package_id",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
'<a role="button" class="show">' +
|
||||
escape_str(`${row.name} (#${row.package_id})`) +
|
||||
"</a>"
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Vendor"),
|
||||
data: "vendor_id",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return row.vendor_id != undefined
|
||||
? '<a href="/cgi-bin/koha/acquisition/vendors/' +
|
||||
row.vendor_id +
|
||||
'">' +
|
||||
escape_str(row.vendor.name) +
|
||||
"</a>"
|
||||
: "";
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Type"),
|
||||
data: "package_type",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
get_lib_from_av(
|
||||
"av_package_types",
|
||||
row.package_type
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Content type"),
|
||||
data: "content_type",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
get_lib_from_av(
|
||||
"av_package_content_types",
|
||||
row.content_type
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Created on"),
|
||||
data: "created_on",
|
||||
searchable: false,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return $date(row.created_on);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Notes"),
|
||||
data: "notes",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return row.notes;
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
getRelationshipTableColumns() {
|
||||
const get_lib_from_av = this.get_lib_from_av;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,11 +50,38 @@ export default {
|
|||
required: true,
|
||||
type: "text",
|
||||
label: __("Publication title"),
|
||||
showInTable: true,
|
||||
},
|
||||
{
|
||||
name: "print_identifier",
|
||||
type: "text",
|
||||
label: __("Print-format identifier"),
|
||||
showInTable: {
|
||||
title: __("Identifier"),
|
||||
data: "print_identifier:online_identifier",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
let print_identifier = row.print_identifier;
|
||||
let online_identifier = row.online_identifier;
|
||||
return [
|
||||
print_identifier
|
||||
? escape_str(
|
||||
__("ISBN (Print): %s").format(
|
||||
print_identifier
|
||||
)
|
||||
)
|
||||
: "",
|
||||
online_identifier
|
||||
? escape_str(
|
||||
__("ISBN (Online): %s").format(
|
||||
online_identifier
|
||||
)
|
||||
)
|
||||
: "",
|
||||
].join("<br/>");
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "online_identifier",
|
||||
|
|
@ -100,6 +127,21 @@ export default {
|
|||
name: "first_author",
|
||||
type: "text",
|
||||
label: __("First author"),
|
||||
showInTable: {
|
||||
title: __("Contributors"),
|
||||
data: "first_author:first_editor",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
escape_str(row.first_author) +
|
||||
(row.first_author && row.first_editor
|
||||
? "<br/>"
|
||||
: "") +
|
||||
escape_str(row.first_editor)
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "embargo_info",
|
||||
|
|
@ -126,6 +168,7 @@ export default {
|
|||
type: "select",
|
||||
label: __("Publication type"),
|
||||
avCat: "av_title_publication_types",
|
||||
showInTable: true,
|
||||
},
|
||||
{
|
||||
name: "date_monograph_published_print",
|
||||
|
|
@ -324,7 +367,6 @@ export default {
|
|||
},
|
||||
],
|
||||
tableOptions: {
|
||||
columns: this.getTableColumns(),
|
||||
url: this.getResourceTableUrl(),
|
||||
options: {
|
||||
embed: "resources.package",
|
||||
|
|
@ -409,83 +451,6 @@ export default {
|
|||
);
|
||||
}
|
||||
},
|
||||
getTableColumns() {
|
||||
let get_lib_from_av = this.get_lib_from_av;
|
||||
let escape_str = this.escape_str;
|
||||
|
||||
return [
|
||||
{
|
||||
title: __("Title"),
|
||||
data: "me.publication_title:me.title_id",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
'<a role="button" class="show">' +
|
||||
escape_str(
|
||||
`${row.publication_title} (#${row.title_id})`
|
||||
) +
|
||||
"</a>"
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Contributors"),
|
||||
data: "first_author:first_editor",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
escape_str(row.first_author) +
|
||||
(row.first_author && row.first_editor
|
||||
? "<br/>"
|
||||
: "") +
|
||||
escape_str(row.first_editor)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Publication type"),
|
||||
data: "publication_type",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
get_lib_from_av(
|
||||
"av_title_publication_types",
|
||||
row.publication_type
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Identifier"),
|
||||
data: "print_identifier:online_identifier",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
let print_identifier = row.print_identifier;
|
||||
let online_identifier = row.online_identifier;
|
||||
return [
|
||||
print_identifier
|
||||
? escape_str(
|
||||
__("ISBN (Print): %s").format(
|
||||
print_identifier
|
||||
)
|
||||
)
|
||||
: "",
|
||||
online_identifier
|
||||
? escape_str(
|
||||
__("ISBN (Online): %s").format(
|
||||
online_identifier
|
||||
)
|
||||
)
|
||||
: "",
|
||||
].join("<br/>");
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
getToolbarButtons() {
|
||||
return [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,11 +52,13 @@ export default {
|
|||
required: true,
|
||||
type: "text",
|
||||
label: __("License name"),
|
||||
showInTable: true,
|
||||
},
|
||||
{
|
||||
name: "vendor_id",
|
||||
type: "vendor",
|
||||
label: __("Vendor"),
|
||||
showInTable: true,
|
||||
showElement: {
|
||||
type: "text",
|
||||
value: "vendor.name",
|
||||
|
|
@ -74,12 +76,14 @@ export default {
|
|||
textAreaRows: 10,
|
||||
textAreaCols: 50,
|
||||
label: __("Description"),
|
||||
showInTable: true,
|
||||
},
|
||||
{
|
||||
name: "type",
|
||||
required: true,
|
||||
type: "select",
|
||||
label: __("Type"),
|
||||
showInTable: true,
|
||||
avCat: "av_license_types",
|
||||
},
|
||||
{
|
||||
|
|
@ -87,12 +91,14 @@ export default {
|
|||
required: true,
|
||||
type: "select",
|
||||
label: __("Status"),
|
||||
showInTable: true,
|
||||
avCat: "av_license_statuses",
|
||||
},
|
||||
{
|
||||
name: "started_on",
|
||||
type: "date",
|
||||
label: __("Start date"),
|
||||
showInTable: true,
|
||||
showElement: {
|
||||
type: "text",
|
||||
value: "started_on",
|
||||
|
|
@ -109,7 +115,7 @@ export default {
|
|||
name: "ended_on",
|
||||
type: "date",
|
||||
label: __("End date"),
|
||||
required: false,
|
||||
showInTable: true,
|
||||
showElement: {
|
||||
type: "text",
|
||||
value: "ended_on",
|
||||
|
|
@ -272,7 +278,6 @@ export default {
|
|||
},
|
||||
],
|
||||
tableOptions: {
|
||||
columns: this.getTableColumns(),
|
||||
url: this.getResourceTableUrl(),
|
||||
options: { embed: "vendor,extended_attributes,+strings" },
|
||||
table_settings: this.license_table_settings,
|
||||
|
|
@ -370,100 +375,6 @@ export default {
|
|||
);
|
||||
}
|
||||
},
|
||||
getTableColumns() {
|
||||
let get_lib_from_av = this.get_lib_from_av;
|
||||
|
||||
return [
|
||||
{
|
||||
title: __("ID"),
|
||||
data: "me.license_id",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
'<a role="button" class="show">' +
|
||||
escape_str(`${row.license_id}`) +
|
||||
"</a>"
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Name"),
|
||||
data: "me.name:me.license_id",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return (
|
||||
'<a role="button" class="show">' +
|
||||
escape_str(row.name) +
|
||||
"</a>"
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Vendor"),
|
||||
data: "vendor_id",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return row.vendor_id != undefined
|
||||
? '<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=' +
|
||||
row.vendor_id +
|
||||
'">' +
|
||||
escape_str(row.vendor.name) +
|
||||
"</a>"
|
||||
: "";
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
title: __("Description"),
|
||||
data: "description",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
},
|
||||
{
|
||||
title: __("Type"),
|
||||
data: "type",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
get_lib_from_av("av_license_types", row.type)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Status"),
|
||||
data: "status",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return escape_str(
|
||||
get_lib_from_av("av_license_statuses", row.status)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Started on"),
|
||||
data: "started_on",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return $date(row.started_on);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Ended on"),
|
||||
data: "ended_on",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
return $date(row.ended_on);
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
},
|
||||
name: "LicenseResource",
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue