Bug 32030: ERM - Refactoring
We want the whole erm.pl to be a Vue app \o/ Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
28e6c5890a
commit
2adaddeea4
13 changed files with 176 additions and 139 deletions
|
@ -1,38 +0,0 @@
|
|||
#! /usr/bin/perl
|
||||
|
||||
# Copyright 2022 Koha Development Team
|
||||
#
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
use CGI qw ( -utf8 );
|
||||
use C4::Context;
|
||||
use C4::Auth qw( get_template_and_user );
|
||||
use C4::Output qw( output_html_with_http_headers );
|
||||
|
||||
use Koha::Cities;
|
||||
|
||||
my $input = CGI->new;
|
||||
|
||||
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
||||
{ template_name => "erm/erm-home.tt",
|
||||
query => $input,
|
||||
type => "intranet",
|
||||
flagsrequired => { erm => '*' },
|
||||
}
|
||||
);
|
||||
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
|
@ -23,13 +23,12 @@ use C4::Output qw( output_html_with_http_headers );
|
|||
|
||||
use Koha::DateUtils qw( dt_from_string );
|
||||
use Koha::Acquisition::Booksellers;
|
||||
use Koha::ERM::Agreements;
|
||||
|
||||
my $input = CGI->new;
|
||||
|
||||
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
||||
{
|
||||
template_name => "erm/agreements.tt",
|
||||
template_name => "erm/erm.tt",
|
||||
query => $input,
|
||||
type => "intranet",
|
||||
flagsrequired => { 'erm' => '1' },
|
|
@ -3,6 +3,7 @@
|
|||
<h5>ERM</h5>
|
||||
<ul>
|
||||
<li><a href="/cgi-bin/koha/erm/agreements.pl">Agreements</a></li>
|
||||
<li><a href="/cgi-bin/koha/erm/licenses.pl">Licenses</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<li><a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a></li>
|
||||
[% END %]
|
||||
[% IF Koha.Preference('ERMModule') && CAN_user_erm %]
|
||||
<li><a href="/cgi-bin/koha/erm/erm-home.pl">Electronic resources management</a></li>
|
||||
<li><a href="/cgi-bin/koha/erm/erm.pl">Electronic resources management</a></li>
|
||||
[% END %]
|
||||
[% IF ( Koha.Preference('UseCourseReserves') ) %]
|
||||
<li><a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a></li>
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
[% USE raw %]
|
||||
[% USE Koha %]
|
||||
[% USE Branches %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>Electronic resources management › Koha</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
</head>
|
||||
<body id="erm_erm-home" class="circ">
|
||||
[% INCLUDE 'header.inc' %]
|
||||
[% INCLUDE 'erm-search.inc' %]
|
||||
|
||||
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
|
||||
<ol>
|
||||
<li>
|
||||
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" aria-current="page">
|
||||
Electronic resources management
|
||||
</a>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="main container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-5 col-md-4">
|
||||
<h3>Electronic resources management</h3>
|
||||
|
||||
<ul class="buttons-list">
|
||||
<li>
|
||||
<a class="erm-button" href="/cgi-bin/koha/erm/agreements.pl"><i class="fa fa-upload"></i> Agreements</a>
|
||||
</li>
|
||||
<li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[% INCLUDE 'intranet-bottom.inc' %]
|
|
@ -7,16 +7,7 @@
|
|||
[% SET footerjs = 1 %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>
|
||||
[% IF op =='add_form' %]
|
||||
[% IF agreement.agreement_id %]
|
||||
Modify agreement
|
||||
[% ELSE %]
|
||||
New agreement
|
||||
[% END %] › [% ELSE %]
|
||||
[% IF op == 'delete_confirm' %]
|
||||
Confirm deletion of agreement › [% END %]
|
||||
[% END %]
|
||||
Agreements › Electronic resources management › Koha
|
||||
Electronic resources management › Koha
|
||||
</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
</head>
|
||||
|
@ -25,40 +16,9 @@
|
|||
[% INCLUDE 'header.inc' %]
|
||||
[% INCLUDE 'erm-search.inc' %]
|
||||
|
||||
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
|
||||
<ol>
|
||||
<li>
|
||||
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/cgi-bin/koha/erm/erm-home.pl">Electronic resources management</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="/cgi-bin/koha/erm/agreements.pl">Agreements</a>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="main container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-10 col-sm-push-2">
|
||||
<main>
|
||||
|
||||
<div id="agreements"></div>
|
||||
|
||||
</main>
|
||||
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
||||
|
||||
<div class="col-sm-2 col-sm-pull-10">
|
||||
<aside>
|
||||
[% INCLUDE 'erm-menu.inc' %]
|
||||
</aside>
|
||||
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
||||
</div> <!-- /.row -->
|
||||
<div id="erm"> <!-- this is closed in intranet-bottom.inc -->
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% Asset.js("js/erm-menu.js") | $raw %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
[% INCLUDE 'columns_settings.inc' %]
|
||||
|
@ -86,8 +46,7 @@
|
|||
[% END %]
|
||||
</script>
|
||||
|
||||
[% Asset.js("js/vue/dist/main.js") %]
|
||||
[% Asset.js("js/vue/dist/runtime.js") %]
|
||||
[% Asset.js("js/vue/dist/main.js") | $raw %]
|
||||
|
||||
[% END %]
|
||||
[% INCLUDE 'intranet-bottom.inc' %]
|
|
@ -114,7 +114,7 @@
|
|||
|
||||
[% IF Koha.Preference('ERMModule') && CAN_user_erm %]
|
||||
<li>
|
||||
<a class="icon_general icon_erm" href="/cgi-bin/koha/erm/erm-home.pl"><i class="fa fa-fw fa-newspaper-o"></i>Electronic resources management</a>
|
||||
<a class="icon_general icon_erm" href="/cgi-bin/koha/erm/erm.pl"><i class="fa fa-fw fa-newspaper-o"></i>Electronic resources management</a>
|
||||
</li>
|
||||
[% END %]
|
||||
|
||||
|
|
|
@ -46,11 +46,11 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import Toolbar from "./components/ERM/AgreementsToolbar.vue"
|
||||
import List from "./components/ERM/AgreementsList.vue"
|
||||
import Show from "./components/ERM/AgreementsShow.vue"
|
||||
import AddForm from "./components/ERM/AgreementsFormAdd.vue"
|
||||
import ConfirmDeleteForm from "./components/ERM/AgreementsFormConfirmDelete.vue"
|
||||
import Toolbar from "./AgreementsToolbar.vue"
|
||||
import List from "./AgreementsList.vue"
|
||||
import Show from "./AgreementsShow.vue"
|
||||
import AddForm from "./AgreementsFormAdd.vue"
|
||||
import ConfirmDeleteForm from "./AgreementsFormConfirmDelete.vue"
|
||||
|
||||
import { reactive, computed } from "vue"
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<template>
|
||||
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
|
||||
<ol>
|
||||
<li>
|
||||
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/cgi-bin/koha/erm/erm.pl"
|
||||
>Electronic resources management</a
|
||||
>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<router-link to="/cgi-bin/koha/erm/agreements">
|
||||
Agreements</router-link
|
||||
>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
switchComponent(component) {
|
||||
this.component = component
|
||||
},
|
||||
},
|
||||
components: {
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,54 @@
|
|||
<template>
|
||||
<Breadcrumb />
|
||||
<div class="main container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-10 col-sm-push-2">
|
||||
<main>
|
||||
<router-view />
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2 col-sm-pull-10">
|
||||
<aside>
|
||||
<div id="navmenu">
|
||||
<div id="navmenulist">
|
||||
<h5>ERM</h5>
|
||||
<ul>
|
||||
<li>
|
||||
<router-link
|
||||
to="/cgi-bin/koha/erm/agreements"
|
||||
>
|
||||
<i class="fa fa-upload"></i>
|
||||
Contact</router-link
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Breadcrumb from "./Breadcrumb.vue"
|
||||
|
||||
import { reactive, computed } from "vue"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
component: "agreement",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
switchComponent(component) {
|
||||
this.component = component
|
||||
},
|
||||
},
|
||||
components: {
|
||||
Breadcrumb,
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,55 @@
|
|||
<template>
|
||||
<Breadcrumb />
|
||||
<div class="main container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-10 col-sm-push-2">
|
||||
<main>
|
||||
<router-view />
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2 col-sm-pull-10">
|
||||
<aside>
|
||||
<div id="navmenu">
|
||||
<div id="navmenulist">
|
||||
<h5>ERM</h5>
|
||||
<ul>
|
||||
<li>
|
||||
<router-link
|
||||
to="/cgi-bin/koha/erm/agreements"
|
||||
>
|
||||
<i class="fa fa-upload"></i>
|
||||
Agreements</router-link
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Breadcrumb from "./Breadcrumb.vue"
|
||||
|
||||
|
||||
import { reactive, computed } from "vue"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
component: "agreement",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
switchComponent(component) {
|
||||
this.component = component
|
||||
},
|
||||
},
|
||||
components: {
|
||||
Breadcrumb,
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -1,13 +1,26 @@
|
|||
import {createApp} from 'vue'
|
||||
import { createApp } from "vue";
|
||||
import { createWebHistory, createRouter } from "vue-router";
|
||||
|
||||
import {library} from "@fortawesome/fontawesome-svg-core"
|
||||
import {faPlus, faPencil, faTrash} from "@fortawesome/free-solid-svg-icons"
|
||||
import {FontAwesomeIcon} from "@fortawesome/vue-fontawesome"
|
||||
import { library } from "@fortawesome/fontawesome-svg-core";
|
||||
import { faPlus, faPencil, faTrash } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||||
|
||||
library.add(faPlus, faPencil, faTrash)
|
||||
library.add(faPlus, faPencil, faTrash);
|
||||
|
||||
import App from './Agreements.vue'
|
||||
import App from "./components/ERM/ERMMain.vue";
|
||||
import Agreements from "./components/ERM/Agreements.vue";
|
||||
|
||||
const Bar = { template: "<div>bar</div>" };
|
||||
const Foo = { template: "<div>foo</div>" };
|
||||
const routes = [
|
||||
{ path: "/cgi-bin/koha/erm/agreements", component: Agreements },
|
||||
{ path: "/cgi-bin/koha/erm/licenses", component: Bar },
|
||||
{ path: "/cgi-bin/koha/erm/erm.pl", component: Foo },
|
||||
];
|
||||
|
||||
const router = createRouter({ history: createWebHistory(), routes });
|
||||
|
||||
createApp(App)
|
||||
.use(router)
|
||||
.component("font-awesome-icon", FontAwesomeIcon)
|
||||
.mount('#agreements')
|
||||
.mount("#erm");
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
"mysql": "^2.18.1",
|
||||
"style-loader": "^3.3.1",
|
||||
"vue": "^3.2.31",
|
||||
"vue-flatpickr-component": "^9"
|
||||
"vue-flatpickr-component": "^9",
|
||||
"vue-router": "^4.0.14"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node_modules/.bin/gulp build",
|
||||
|
|
Loading…
Reference in a new issue