Jonathan Druart
0c763b7dc4
* Remove ":" from the translation to prevent duplication string * Add a script to auto-translate the strings in English echo "{}" > koha-tmpl/intranet-tmpl/prog/js/vue/locales/en.json npx vue-i18n-extract --vueFiles 'koha-tmpl/intranet-tmpl/prog/js/vue/**/*.?(js|vue)' \ --exclude koha-tmpl/intranet-tmpl/prog/js/vue/dist/main.js \ --languageFiles 'koha-tmpl/intranet-tmpl/prog/js/vue/locales/*.json' \ --add --remove perl misc/translate_json.pl | sponge koha-tmpl/intranet-tmpl/prog/js/vue/locales/en.json 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>
91 lines
2.7 KiB
Vue
91 lines
2.7 KiB
Vue
<template>
|
|
<div v-if="!this.initialized">{{ $t("Loading") }}</div>
|
|
<div v-else id="licenses_confirm_delete">
|
|
<h2>{{ $t("Delete license") }}</h2>
|
|
<div>
|
|
<form @submit="onSubmit($event)">
|
|
<fieldset class="rows">
|
|
<ol>
|
|
<li>
|
|
{{ $t("License name") }}:
|
|
{{ license.name }}
|
|
</li>
|
|
<li>
|
|
{{ $t("Description") }}:
|
|
{{ license.description }}
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input
|
|
type="submit"
|
|
variant="primary"
|
|
:value="$t('Yes, delete')"
|
|
/>
|
|
<router-link
|
|
to="/cgi-bin/koha/erm/licenses"
|
|
role="button"
|
|
class="cancel"
|
|
>{{ $t("No, do not delete") }}</router-link
|
|
>
|
|
</fieldset>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { fetchLicense } from "../../fetch"
|
|
import { setMessage, setError } from "../../messages"
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
license: {},
|
|
initialized: false,
|
|
}
|
|
},
|
|
beforeRouteEnter(to, from, next) {
|
|
next(vm => {
|
|
vm.license = vm.getLicense(to.params.license_id)
|
|
vm.initialized = true
|
|
})
|
|
},
|
|
methods: {
|
|
async getLicense(license_id) {
|
|
const license = await fetchLicense(license_id)
|
|
this.license = license
|
|
this.initialized = true
|
|
},
|
|
onSubmit(e) {
|
|
e.preventDefault()
|
|
|
|
let apiUrl = '/api/v1/erm/licenses/' + this.license.license_id
|
|
|
|
const options = {
|
|
method: 'DELETE',
|
|
headers: {
|
|
'Content-Type': 'application/json;charset=utf-8'
|
|
},
|
|
}
|
|
|
|
fetch(apiUrl, options)
|
|
.then(
|
|
(response) => {
|
|
if (response.status == 204) {
|
|
this.$router.push("/cgi-bin/koha/erm/licenses")
|
|
setMessage(this.$t("License deleted"))
|
|
} else {
|
|
setError(response.message || response.statusText)
|
|
}
|
|
}
|
|
).catch(
|
|
(error) => {
|
|
setError(error)
|
|
}
|
|
)
|
|
}
|
|
},
|
|
name: "LicensesFormConfirmDelete",
|
|
}
|
|
</script>
|