Bug 38201: Move additionalProps to data
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
8b93b18450
commit
c503d58197
|
|
@ -82,18 +82,6 @@ export default {
|
|||
const format_date = $date;
|
||||
const patron_to_html = $patron_to_html;
|
||||
|
||||
const optionalResourceProps = {
|
||||
embedded: props.embedded || false,
|
||||
extendedAttributesResourceType:
|
||||
props.extendedAttributesResourceType || null,
|
||||
resourceListFiltersRequired:
|
||||
props.resourceListFiltersRequired || null,
|
||||
formGroupsDisplayMode: props.formGroupsDisplayMode || null,
|
||||
appendToShow: props.appendToShow || [],
|
||||
nameAttr: props.nameAttr || null,
|
||||
idAttr: props.idAttr || null,
|
||||
};
|
||||
|
||||
return {
|
||||
...props,
|
||||
setConfirmationDialog,
|
||||
|
|
@ -107,12 +95,23 @@ export default {
|
|||
get_lib_from_av,
|
||||
map_av_dt_filter,
|
||||
build_url,
|
||||
optionalResourceProps,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
const optionalResourceProps = {
|
||||
embedded: this.embedded || false,
|
||||
extendedAttributesResourceType:
|
||||
this.extendedAttributesResourceType || null,
|
||||
resourceListFiltersRequired:
|
||||
this.resourceListFiltersRequired || null,
|
||||
formGroupsDisplayMode: this.formGroupsDisplayMode || null,
|
||||
appendToShow: this.appendToShow ? this.appendToShow() : [],
|
||||
nameAttr: this.nameAttr || null,
|
||||
idAttr: this.idAttr || null,
|
||||
};
|
||||
return {
|
||||
resourceToBeGenerated: {},
|
||||
optionalResourceProps,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -19,94 +19,6 @@ export default {
|
|||
const vendorStore = inject("vendorStore");
|
||||
const { vendors } = storeToRefs(vendorStore);
|
||||
|
||||
const appendToShow = get_lib_from_av => {
|
||||
return [
|
||||
{
|
||||
type: "component",
|
||||
name: __("Titles"),
|
||||
hidden: erm_package => erm_package,
|
||||
componentPath: "./RelationshipTableDisplay.vue",
|
||||
componentProps: {
|
||||
tableOptions: {
|
||||
type: "object",
|
||||
value: {
|
||||
columns: [
|
||||
{
|
||||
title: __("Name"),
|
||||
data: "title.publication_title",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (
|
||||
data,
|
||||
type,
|
||||
row,
|
||||
meta
|
||||
) {
|
||||
return (
|
||||
'<a href="/cgi-bin/koha/erm/eholdings/local/resources/' +
|
||||
row.resource_id +
|
||||
'" class="show">' +
|
||||
escape_str(
|
||||
`${row.title.publication_title} (#${row.title.title_id})`
|
||||
) +
|
||||
"</a>"
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Publication type"),
|
||||
data: "title.publication_type",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (
|
||||
data,
|
||||
type,
|
||||
row,
|
||||
meta
|
||||
) {
|
||||
return escape_str(
|
||||
get_lib_from_av(
|
||||
"av_title_publication_types",
|
||||
row.title.publication_type
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
options: {
|
||||
embed: "title",
|
||||
},
|
||||
url:
|
||||
APIClient.erm.httpClient._baseURL +
|
||||
"eholdings/local/resources",
|
||||
},
|
||||
},
|
||||
apiClient: {
|
||||
type: "object",
|
||||
value: APIClient.erm.localPackages,
|
||||
},
|
||||
filters: {
|
||||
type: "filter",
|
||||
keys: {
|
||||
package_id: { property: "package_id" },
|
||||
},
|
||||
},
|
||||
resource: {
|
||||
type: "resource",
|
||||
},
|
||||
resourceName: {
|
||||
type: "string",
|
||||
value: "title",
|
||||
},
|
||||
resourceNamePlural: {
|
||||
type: "string",
|
||||
value: "titles",
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
return {
|
||||
...BaseResource.setup({
|
||||
resourceName: "package",
|
||||
|
|
@ -135,7 +47,7 @@ export default {
|
|||
av_package_content_types,
|
||||
eholdings_packages_table_settings,
|
||||
vendors,
|
||||
appendToShow: appendToShow(get_lib_from_av),
|
||||
get_lib_from_av,
|
||||
}),
|
||||
};
|
||||
},
|
||||
|
|
@ -367,6 +279,94 @@ export default {
|
|||
);
|
||||
}
|
||||
},
|
||||
appendToShow() {
|
||||
let get_lib_from_av = this.get_lib_from_av;
|
||||
return [
|
||||
{
|
||||
type: "component",
|
||||
name: __("Titles"),
|
||||
hidden: erm_package => erm_package,
|
||||
componentPath: "./RelationshipTableDisplay.vue",
|
||||
componentProps: {
|
||||
tableOptions: {
|
||||
type: "object",
|
||||
value: {
|
||||
columns: [
|
||||
{
|
||||
title: __("Name"),
|
||||
data: "title.publication_title",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (
|
||||
data,
|
||||
type,
|
||||
row,
|
||||
meta
|
||||
) {
|
||||
return (
|
||||
'<a href="/cgi-bin/koha/erm/eholdings/local/resources/' +
|
||||
row.resource_id +
|
||||
'" class="show">' +
|
||||
escape_str(
|
||||
`${row.title.publication_title} (#${row.title.title_id})`
|
||||
) +
|
||||
"</a>"
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: __("Publication type"),
|
||||
data: "title.publication_type",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
render: function (
|
||||
data,
|
||||
type,
|
||||
row,
|
||||
meta
|
||||
) {
|
||||
return escape_str(
|
||||
get_lib_from_av(
|
||||
"av_title_publication_types",
|
||||
row.title.publication_type
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
options: {
|
||||
embed: "title",
|
||||
},
|
||||
url:
|
||||
APIClient.erm.httpClient._baseURL +
|
||||
"eholdings/local/resources",
|
||||
},
|
||||
},
|
||||
apiClient: {
|
||||
type: "object",
|
||||
value: APIClient.erm.localPackages,
|
||||
},
|
||||
filters: {
|
||||
type: "filter",
|
||||
keys: {
|
||||
package_id: { property: "package_id" },
|
||||
},
|
||||
},
|
||||
resource: {
|
||||
type: "resource",
|
||||
},
|
||||
resourceName: {
|
||||
type: "string",
|
||||
value: "title",
|
||||
},
|
||||
resourceNamePlural: {
|
||||
type: "string",
|
||||
value: "titles",
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
},
|
||||
name: "EHoldingsLocalPackageResource",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,23 +17,6 @@ export default {
|
|||
const vendorStore = inject("vendorStore");
|
||||
const { vendors } = storeToRefs(vendorStore);
|
||||
|
||||
function additionalToolbarButtons(resource) {
|
||||
return {
|
||||
list: [
|
||||
{
|
||||
to: { name: "EHoldingsLocalTitlesFormImport" },
|
||||
icon: "plus",
|
||||
title: __("Import from list"),
|
||||
},
|
||||
{
|
||||
to: { name: "EHoldingsLocalTitlesKBARTImport" },
|
||||
icon: "plus",
|
||||
title: __("Import from KBART file"),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...BaseResource.setup({
|
||||
resourceName: "title",
|
||||
|
|
@ -60,7 +43,6 @@ export default {
|
|||
av_title_publication_types,
|
||||
eholdings_titles_table_settings,
|
||||
vendors,
|
||||
additionalToolbarButtons,
|
||||
}),
|
||||
};
|
||||
},
|
||||
|
|
@ -494,6 +476,22 @@ export default {
|
|||
);
|
||||
}
|
||||
},
|
||||
additionalToolbarButtons(resource) {
|
||||
return {
|
||||
list: [
|
||||
{
|
||||
to: { name: "EHoldingsLocalTitlesFormImport" },
|
||||
icon: "plus",
|
||||
title: __("Import from list"),
|
||||
},
|
||||
{
|
||||
to: { name: "EHoldingsLocalTitlesKBARTImport" },
|
||||
icon: "plus",
|
||||
title: __("Import from KBART file"),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
},
|
||||
emits: ["select-resource"],
|
||||
name: "EHoldingsLocalTitlesResource",
|
||||
|
|
|
|||
|
|
@ -16,51 +16,6 @@ export default {
|
|||
const PreservationStore = inject("PreservationStore");
|
||||
const { config } = storeToRefs(PreservationStore);
|
||||
|
||||
function additionalToolbarButtons(resource) {
|
||||
return {
|
||||
show: [
|
||||
resource?.closed_on == null
|
||||
? {
|
||||
to: {
|
||||
name: "TrainsFormAddItem",
|
||||
params: { train_id: resource?.train_id },
|
||||
},
|
||||
icon: "plus",
|
||||
title: __("Add items"),
|
||||
index: -1,
|
||||
}
|
||||
: {},
|
||||
!resource?.closed_on &&
|
||||
!resource?.sent_on &&
|
||||
!resource?.received_on
|
||||
? {
|
||||
onClick: () => this.closeTrain(resource),
|
||||
icon: "remove",
|
||||
title: __("Close"),
|
||||
}
|
||||
: {},
|
||||
resource?.closed_on &&
|
||||
!resource?.sent_on &&
|
||||
!resource?.received_on
|
||||
? {
|
||||
onClick: () => this.sendTrain(resource),
|
||||
icon: "paper-plane",
|
||||
title: __("Send"),
|
||||
}
|
||||
: {},
|
||||
resource?.closed_on &&
|
||||
resource?.sent_on &&
|
||||
!resource?.received_on
|
||||
? {
|
||||
onClick: () => this.receiveTrain(resource),
|
||||
icon: "inbox",
|
||||
title: __("Receive"),
|
||||
}
|
||||
: {},
|
||||
].filter(b => Object.keys(b).length),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...BaseResource.setup({
|
||||
resourceName: "train",
|
||||
|
|
@ -88,7 +43,6 @@ export default {
|
|||
},
|
||||
av_notforloan,
|
||||
config,
|
||||
additionalToolbarButtons,
|
||||
}),
|
||||
};
|
||||
},
|
||||
|
|
@ -361,6 +315,50 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
additionalToolbarButtons(resource) {
|
||||
return {
|
||||
show: [
|
||||
resource?.closed_on == null
|
||||
? {
|
||||
to: {
|
||||
name: "TrainsFormAddItem",
|
||||
params: { train_id: resource?.train_id },
|
||||
},
|
||||
icon: "plus",
|
||||
title: __("Add items"),
|
||||
index: -1,
|
||||
}
|
||||
: {},
|
||||
!resource?.closed_on &&
|
||||
!resource?.sent_on &&
|
||||
!resource?.received_on
|
||||
? {
|
||||
onClick: () => this.closeTrain(resource),
|
||||
icon: "remove",
|
||||
title: __("Close"),
|
||||
}
|
||||
: {},
|
||||
resource?.closed_on &&
|
||||
!resource?.sent_on &&
|
||||
!resource?.received_on
|
||||
? {
|
||||
onClick: () => this.sendTrain(resource),
|
||||
icon: "paper-plane",
|
||||
title: __("Send"),
|
||||
}
|
||||
: {},
|
||||
resource?.closed_on &&
|
||||
resource?.sent_on &&
|
||||
!resource?.received_on
|
||||
? {
|
||||
onClick: () => this.receiveTrain(resource),
|
||||
icon: "inbox",
|
||||
title: __("Receive"),
|
||||
}
|
||||
: {},
|
||||
].filter(b => Object.keys(b).length),
|
||||
};
|
||||
},
|
||||
},
|
||||
name: "TrainResource",
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue