From b6e48dc73ad46dcc08acccfd264fb6778f9a7816 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Wed, 29 Jan 2025 18:14:57 +0000 Subject: [PATCH] Bug 38201: Migrate UserRoles and Documents to RelationshipWidget Signed-off-by: Michaela Sieber Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass --- .../vue/components/ERM/AgreementResource.vue | 56 ++++++++---- .../prog/js/vue/components/ERM/Documents.vue | 74 --------------- .../js/vue/components/ERM/LicenseResource.vue | 54 ++++++++--- .../prog/js/vue/components/ERM/UserRoles.vue | 91 ------------------- .../prog/js/vue/components/PatronSearch.vue | 3 +- 5 files changed, 82 insertions(+), 196 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Documents.vue delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue index 3002b84e78..49a50885e6 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue @@ -259,7 +259,6 @@ export default { }, ], }, - label: __("Periods"), group: __("Periods"), props: { resourceRelationships: { @@ -346,9 +345,8 @@ export default { }, { name: "user_roles", - type: "component", + type: "relationshipWidget", group: __("Users"), - componentPath: "./ERM/UserRoles.vue", showElement: { type: "table", columnData: "user_roles", @@ -367,17 +365,25 @@ export default { ], }, props: { - user_roles: { + resourceRelationships: { type: "resourceProperty", resourceProperty: "user_roles", }, - av_user_roles: { - type: "av", - av: null, + resourceStrings: { + type: "object", + value: { + nameLC: __("user"), + nameUC: __("Agreement user"), + namePL: __("users"), + }, }, - user_type: { - type: "string", - value: __("Agreement user %s"), + newRelationship: { + type: "object", + value: { + user_id: null, + role: null, + patron_str: "", + }, }, }, subFields: [ @@ -423,7 +429,6 @@ export default { { name: "licenses", type: "relationshipWidget", - label: __("Licenses"), group: __("Licenses"), showElement: { type: "table", @@ -551,7 +556,6 @@ export default { { name: "relationships", type: "relationshipWidget", - label: __("Relationships"), group: __("Relationships"), showElement: { type: "component", @@ -645,11 +649,11 @@ export default { }, { name: "documents", - type: "component", - componentPath: "./ERM/Documents.vue", - group: "Documents", + type: "relationshipWidget", + group: __("Documents"), showElement: { type: "component", + label: __("Agreement users"), hidden: agreement => !!agreement.documents?.length, componentPath: "./DocumentDisplay.vue", props: { @@ -660,10 +664,30 @@ export default { }, }, props: { - documents: { + resourceRelationships: { type: "resourceProperty", resourceProperty: "documents", }, + resourceStrings: { + type: "object", + value: { + nameLC: __("document"), + nameUC: __("Document"), + namePL: __("documents"), + }, + }, + newRelationship: { + type: "object", + value: { + file_name: null, + file_type: null, + file_description: null, + file_content: null, + physical_location: null, + uri: null, + notes: null, + }, + }, }, subFields: [ { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Documents.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Documents.vue deleted file mode 100644 index c2edec7ab2..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Documents.vue +++ /dev/null @@ -1,74 +0,0 @@ - - - diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue index f39074a979..17128ee0a7 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue @@ -244,13 +244,13 @@ export default { }, { name: "user_roles", - type: "relationship", - label: __("Users"), - componentPath: "./ERM/UserRoles.vue", + type: "relationshipWidget", + group: __("Users"), showElement: { type: "table", columnData: "user_roles", hidden: license => !!license.user_roles?.length, + label: __("License users"), columns: [ { name: __("Name"), @@ -265,17 +265,25 @@ export default { ], }, props: { - user_roles: { + resourceRelationships: { type: "resourceProperty", resourceProperty: "user_roles", }, - av_user_roles: { - type: "av", - av: null, + resourceStrings: { + type: "object", + value: { + nameLC: __("user"), + nameUC: __("License user"), + namePL: __("users"), + }, }, - user_type: { - type: "string", - value: __("License user %s"), + newRelationship: { + type: "object", + value: { + user_id: null, + role: null, + patron_str: "", + }, }, }, subFields: [ @@ -320,8 +328,8 @@ export default { }, { name: "documents", - type: "relationship", - componentPath: "./ERM/Documents.vue", + type: "relationshipWidget", + group: __("Documents"), showElement: { type: "component", hidden: license => !!license.documents?.length, @@ -334,10 +342,30 @@ export default { }, }, props: { - documents: { + resourceRelationships: { type: "resourceProperty", resourceProperty: "documents", }, + resourceStrings: { + type: "object", + value: { + nameLC: __("document"), + nameUC: __("Document"), + namePL: __("documents"), + }, + }, + newRelationship: { + type: "object", + value: { + file_name: null, + file_type: null, + file_description: null, + file_content: null, + physical_location: null, + uri: null, + notes: null, + }, + }, }, subFields: [ { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue deleted file mode 100644 index 7ea1246d8d..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue +++ /dev/null @@ -1,91 +0,0 @@ - - - diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/PatronSearch.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/PatronSearch.vue index dfdce0d2c9..1ffdbebd49 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/PatronSearch.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/PatronSearch.vue @@ -10,6 +10,7 @@ data-bs-toggle="modal" > {{ $__("Select user") }} +