@@ -, +, @@
---
.../prog/js/vue/components/Dialog.vue | 53 +++++++++++++++----
.../js/vue/components/ERM/AgreementsList.vue | 29 +++++-----
.../intranet-tmpl/prog/js/vue/stores/main.js | 21 +++++++-
3 files changed, 78 insertions(+), 25 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Dialog.vue
+++ a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Dialog.vue
@@ -3,14 +3,6 @@
+
@@ -35,13 +47,21 @@ import { storeToRefs } from "pinia"
export default {
setup() {
const mainStore = inject("mainStore")
- const { message, error, warning, accept, is_submitting, is_loading } =
- storeToRefs(mainStore)
+ const {
+ message,
+ error,
+ warning,
+ confirmation,
+ accept,
+ is_submitting,
+ is_loading,
+ } = storeToRefs(mainStore)
const { removeMessages } = mainStore
return {
message,
error,
warning,
+ confirmation,
accept,
is_submitting,
is_loading,
@@ -84,4 +104,17 @@ export default {
left: 40%;
width: 10%;
}
+
+.confirmation {
+ position: absolute;
+ top: 25%;
+ left: 40%;
+
+ display: flex;
+ width: 50%;
+ min-height: 10%;
+ margin: auto;
+ align-items: center;
+ justify-content: center;
+}
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue
+++ a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue
@@ -49,7 +49,7 @@ export default {
const AVStore = inject("AVStore")
const { get_lib_from_av, map_av_dt_filter } = AVStore
- const { setWarning, setMessage } = inject("mainStore")
+ const { setConfirmation, setMessage } = inject("mainStore")
const table_id = "agreement_list"
useDataTable(table_id)
@@ -59,7 +59,7 @@ export default {
get_lib_from_av,
map_av_dt_filter,
table_id,
- setWarning,
+ setConfirmation,
setMessage,
}
},
@@ -115,22 +115,25 @@ export default {
)
},
delete_agreement: function (agreement_id) {
- this.setWarning(this.$__("Are you sure you want to remove this agreement?"), () => {
- const client = APIClient.erm
- client.agreements.delete(agreement_id).then(
- success => {
- this.setMessage(this.$__("Agreement deleted"))
- this.refresh_table()
- },
- error => {}
- )
- })
+ this.setConfirmation(
+ this.$__("Are you sure you want to remove this agreement?"),
+ () => {
+ const client = APIClient.erm
+ client.agreements.delete(agreement_id).then(
+ success => {
+ this.setMessage(this.$__("Agreement deleted"))
+ this.refresh_table()
+ },
+ error => {}
+ )
+ }
+ )
},
select_agreement: function (agreement_id) {
this.$emit("select-agreement", agreement_id)
this.$emit("close")
},
- refresh_table: function(){
+ refresh_table: function () {
$("#" + this.table_id)
.DataTable()
.ajax.url(this.datatable_url)
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js
+++ a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js
@@ -5,6 +5,7 @@ export const useMainStore = defineStore("main", {
_message: null,
_error: null,
_warning: null,
+ _confirmation: null,
_accept: null,
previousMessage: null,
previousError: null,
@@ -17,30 +18,43 @@ export const useMainStore = defineStore("main", {
this._error = null;
this._warning = null;
this._message = message;
+ this._confirmation = null;
this.displayed_already = displayed; /* Will be displayed on the next view */
},
setError(error, displayed = true) {
this._error = error;
+ this._warning = null;
this._message = null;
+ this._confirmation = null;
this.displayed_already = displayed; /* Is displayed on the current view */
},
setWarning(warning, accept, displayed = true) {
+ this._error = null;
+ this._warning = warning;
+ this._message = null;
+ this._confirmation = null;
+ this.displayed_already = displayed; /* Is displayed on the current view */
+ },
+ setConfirmation(confirmation, accept, displayed = true){
if(accept) {
this._accept = async () => {
await accept()
this.removeMessages()
}
}
- this._warning = warning;
+ this._error = null;
+ this._warning = null;
this._message = null;
+ this._confirmation = confirmation;
this.displayed_already = displayed; /* Is displayed on the current view */
},
removeMessages() {
if (this.displayed_already) {
- this._accept = null;
this._error = null;
this._warning = null;
this._message = null;
+ this._confirmation = null;
+ this._accept = null;
}
this.displayed_already = true;
},
@@ -67,6 +81,9 @@ export const useMainStore = defineStore("main", {
message() {
return this._message
},
+ confirmation() {
+ return this._confirmation
+ },
accept() {
return this._accept
},
--