View | Details | Raw Unified | Return to bug 14962
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysBatchAddItems.vue (-9 / +5 lines)
Lines 104-122 export default { Link Here
104
        const batchAdd = event => {
104
        const batchAdd = event => {
105
            event.preventDefault();
105
            event.preventDefault();
106
106
107
            barcodes.value = barcodes.value
107
            const barcodeList = barcodes.value
108
                .split("\n")
108
                .split("\n")
109
                .map(n => Number(n))
109
                .map(n => n.trim())
110
                .filter(n => {
110
                .filter(n => n !== "");
111
                    if (n == "") return false;
112
113
                    return true;
114
                });
115
111
116
            const client = APIClient.display;
112
            const client = APIClient.display;
117
            const importData = {
113
            const importData = {
118
                display_id: display_id.value,
114
                display_id: display_id.value,
119
                barcodes: barcodes.value,
115
                barcodes: barcodeList,
120
            };
116
            };
121
            if (date_remove.value != null)
117
            if (date_remove.value != null)
122
                importData.date_remove = date_remove.value;
118
                importData.date_remove = date_remove.value;
Lines 136-141 export default { Link Here
136
                            ),
132
                            ),
137
                            true
133
                            true
138
                        );
134
                        );
135
                    clearForm();
139
                },
136
                },
140
                error => {
137
                error => {
141
                    setError(
138
                    setError(
Lines 147-153 export default { Link Here
147
                    console.error(error);
144
                    console.error(error);
148
                }
145
                }
149
            );
146
            );
150
            clearForm();
151
        };
147
        };
152
        const clearForm = () => {
148
        const clearForm = () => {
153
            display_id.value = null;
149
            display_id.value = null;
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysBatchRemoveItems.vue (-20 / +17 lines)
Lines 65-73 Link Here
65
</template>
65
</template>
66
66
67
<script>
67
<script>
68
import { ref, inject, useTemplateRef, onBeforeMount } from "vue";
68
import { ref, inject, onBeforeMount } from "vue";
69
import ButtonSubmit from "../ButtonSubmit.vue";
69
import ButtonSubmit from "../ButtonSubmit.vue";
70
import { storeToRefs } from "pinia";
71
import { APIClient } from "../../fetch/api-client.js";
70
import { APIClient } from "../../fetch/api-client.js";
72
import { $__ } from "@koha-vue/i18n";
71
import { $__ } from "@koha-vue/i18n";
73
72
Lines 78-86 export default { Link Here
78
        embedEvent: Function,
77
        embedEvent: Function,
79
    },
78
    },
80
    setup(props) {
79
    setup(props) {
81
        const DisplayStore = inject("DisplayStore");
80
        const { setMessage, setError } = inject("mainStore");
82
        const { config } = storeToRefs(DisplayStore);
83
        const { setMessage, setWarning, setError } = inject("mainStore");
84
81
85
        const displays = ref([]);
82
        const displays = ref([]);
86
        const display_id = ref(null);
83
        const display_id = ref(null);
Lines 89-115 export default { Link Here
89
        const batchRemove = event => {
86
        const batchRemove = event => {
90
            event.preventDefault();
87
            event.preventDefault();
91
88
92
            barcodes.value = barcodes.value
89
            const barcodeList = barcodes.value
93
                .split("\n")
90
                .split("\n")
94
                .map(n => Number(n))
91
                .map(n => n.trim())
95
                .filter(n => {
92
                .filter(n => n !== "");
96
                    if (n == "") return false;
97
98
                    return true;
99
                });
100
93
101
            const client = APIClient.display;
94
            const client = APIClient.display;
102
            const importData = {
95
            const importData = {
103
                display_id: display_id.value,
96
                display_id: display_id.value,
104
                barcodes: barcodes.value,
97
                barcodes: barcodeList,
105
            };
98
            };
106
99
107
            client.displayItems.batchDelete(importData).then(
100
            client.displayItems.batchDelete(importData).then(
108
                success => {
101
                success => {
109
                    setMessage(
102
                    if (success && success.job_id)
110
                        `${$__("Batch job successfully queued.")} <a href="/cgi-bin/koha/admin/background_jobs.pl" target="_blank">${$__("Click here to view job progress")}</a>`,
103
                        setMessage(
111
                        true
104
                            `${$__("Batch job successfully queued.")} <a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=${success.job_id}" target="_blank">${$__("Click here to view job progress")}</a>`,
112
                    );
105
                            true
106
                        );
107
                    else
108
                        setMessage(
109
                            `${$__("Batch job successfully queued.")} <a href="/cgi-bin/koha/admin/background_jobs.pl" target="_blank">${$__("Click here to view job progress")}</a>`,
110
                            true
111
                        );
112
                    clearForm();
113
                },
113
                },
114
                error => {
114
                error => {
115
                    setError(
115
                    setError(
Lines 121-127 export default { Link Here
121
                    console.error(error);
121
                    console.error(error);
122
                }
122
                }
123
            );
123
            );
124
            clearForm();
125
        };
124
        };
126
        const clearForm = () => {
125
        const clearForm = () => {
127
            display_id.value = null;
126
            display_id.value = null;
Lines 139-145 export default { Link Here
139
        });
138
        });
140
        return {
139
        return {
141
            setMessage,
140
            setMessage,
142
            setWarning,
143
            displays,
141
            displays,
144
            display_id,
142
            display_id,
145
            barcodes,
143
            barcodes,
146
- 

Return to bug 14962