@@ -, +, @@
Removed FormConfirmDelete component and routes.
---
.../EHoldingsLocalTitlesFormConfirmDelete.vue | 76 -------------------
.../ERM/EHoldingsLocalTitlesList.vue | 42 +++++++++-
.../ERM/EHoldingsLocalTitlesShow.vue | 41 +++++++++-
.../intranet-tmpl/prog/js/vue/routes/erm.js | 17 -----
4 files changed, 75 insertions(+), 101 deletions(-)
delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormConfirmDelete.vue
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormConfirmDelete.vue
+++ a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormConfirmDelete.vue
@@ -1,76 +0,0 @@
-
- {{ $__("Loading") }}
-
-
{{ $__("Delete title") }}
-
-
-
-
-
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue
+++ a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue
@@ -30,6 +30,8 @@ export default {
const { av_title_publication_types } = storeToRefs(AVStore)
const { get_lib_from_av, map_av_dt_filter } = AVStore
+ const { setConfirmationDialog, setMessage } = inject("mainStore")
+
const table_id = "title_list"
useDataTable(table_id)
@@ -38,6 +40,8 @@ export default {
get_lib_from_av,
map_av_dt_filter,
table_id,
+ setConfirmationDialog,
+ setMessage,
}
},
data: function () {
@@ -77,9 +81,33 @@ export default {
"/cgi-bin/koha/erm/eholdings/local/titles/edit/" + title_id
)
},
- delete_title: function (title_id) {
- this.$router.push(
- "/cgi-bin/koha/erm/eholdings/local/titles/delete/" + title_id
+ delete_title: function (title_id, title_publication_title) {
+ this.setConfirmationDialog(
+ {
+ title: this.$__(
+ "Are you sure you want to remove this title?"
+ ),
+ message: title_publication_title,
+ accept_label: this.$__("Yes, delete"),
+ cancel_label: this.$__("No, do not delete"),
+ },
+ () => {
+ const client = APIClient.erm
+ client.localTitles.delete(title_id).then(
+ success => {
+ this.setMessage(
+ this.$__("Local title %s deleted").format(
+ title_publication_title
+ )
+ )
+ $("#" + this.table_id)
+ .DataTable()
+ .ajax.url("/api/v1/erm/eholdings/local/titles")
+ .draw()
+ },
+ error => {}
+ )
+ }
)
},
build_datatable: function () {
@@ -193,6 +221,9 @@ export default {
function (index, e) {
let tr = $(this).parent().parent()
let title_id = api.row(tr).data().title_id
+ let title_publication_title = api
+ .row(tr)
+ .data().publication_title
let editButton = createVNode(
"a",
{
@@ -217,7 +248,10 @@ export default {
class: "btn btn-default btn-xs",
role: "button",
onClick: () => {
- delete_title(title_id)
+ delete_title(
+ title_id,
+ title_publication_title
+ )
},
},
[
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesShow.vue
+++ a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesShow.vue
@@ -10,11 +10,12 @@
>
-
+ >
@@ -264,9 +265,12 @@ export default {
setup() {
const AVStore = inject("AVStore")
const { get_lib_from_av } = AVStore
+ const { setConfirmationDialog, setMessage } = inject("mainStore")
return {
get_lib_from_av,
+ setConfirmationDialog,
+ setMessage,
}
},
data() {
@@ -322,6 +326,34 @@ export default {
error => {}
)
},
+ delete_title: function (title_id, title_publication_title) {
+ this.setConfirmationDialog(
+ {
+ title: this.$__(
+ "Are you sure you want to remove this title?"
+ ),
+ message: title_publication_title,
+ accept_label: this.$__("Yes, delete"),
+ cancel_label: this.$__("No, do not delete"),
+ },
+ () => {
+ const client = APIClient.erm
+ client.localTitles.delete(title_id).then(
+ success => {
+ this.setMessage(
+ this.$__("Local title %s deleted").format(
+ title_publication_title
+ )
+ )
+ this.$router.push(
+ "/cgi-bin/koha/erm/eholdings/local/titles"
+ )
+ },
+ error => {}
+ )
+ }
+ )
+ },
},
components: {
EHoldingsTitlePackagesList,
@@ -333,6 +365,7 @@ export default {
.action_links a {
padding-left: 0.2em;
font-size: 11px;
+ cursor: pointer;
}
fieldset.rows label {
width: 25rem;
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js
+++ a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js
@@ -4,7 +4,6 @@ import AgreementsShow from "../components/ERM/AgreementsShow.vue";
import AgreementsFormAdd from "../components/ERM/AgreementsFormAdd.vue";
import AgreementsFormConfirmDelete from "../components/ERM/AgreementsFormConfirmDelete.vue";
import EHoldingsLocalPackagesFormAdd from "../components/ERM/EHoldingsLocalPackagesFormAdd.vue";
-import EHoldingsLocalTitlesFormConfirmDelete from "../components/ERM/EHoldingsLocalTitlesFormConfirmDelete.vue";
import EHoldingsLocalTitlesFormAdd from "../components/ERM/EHoldingsLocalTitlesFormAdd.vue";
import EHoldingsLocalTitlesFormImport from "../components/ERM/EHoldingsLocalTitlesFormImport.vue";
import EHoldingsLocalPackagesList from "../components/ERM/EHoldingsLocalPackagesList.vue";
@@ -314,22 +313,6 @@ export const routes = [
),
},
},
- {
- path: "delete/:title_id",
- component:
- EHoldingsLocalTitlesFormConfirmDelete,
- meta: {
- breadcrumb: () =>
- build_breadcrumb(
- [
- breadcrumb_paths.eholdings_local,
- breadcrumbs.eholdings.local
- .titles,
- ],
- "Delete title" // $t("Delete title")
- ),
- },
- },
{
path: "add",
component: EHoldingsLocalTitlesFormAdd,
--