|
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 |
- |
|
|