2023-08-21 15:22:56 +08:00
|
|
|
<template>
|
|
|
|
<div ref="modal" @keydown.esc="cancel" class="modal" id="modalDestroyProtocolContent" tabindex="-1" role="dialog">
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="sn-icon sn-icon-close"></i></button>
|
|
|
|
<h4 class="modal-title" id="modal-destroy-team-label">
|
|
|
|
{{ i18n.t(`protocols.steps.modals.move_element.${parent_type}.title`) }}
|
|
|
|
</h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<label>
|
|
|
|
{{ i18n.t(`protocols.steps.modals.move_element.${parent_type}.targets_label`) }}
|
|
|
|
</label>
|
|
|
|
<div class="w-full">
|
|
|
|
<Select
|
|
|
|
:value="target"
|
2023-09-01 17:37:48 +08:00
|
|
|
:options="targetOptions"
|
2023-08-21 15:22:56 +08:00
|
|
|
v-bind:disabled="false"
|
|
|
|
@change="setTarget"
|
|
|
|
></Select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button class="btn btn-secondary" @click="cancel">{{ i18n.t('general.cancel') }}</button>
|
2023-09-01 15:59:56 +08:00
|
|
|
<button class="btn btn-primary" @click="confirm">{{ i18n.t('general.move')}}</button>
|
2023-08-21 15:22:56 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import axios from '../../../../packs/custom_axios.js';
|
|
|
|
import Select from "../../select.vue";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'moveElementModal',
|
|
|
|
props: {
|
|
|
|
parent_type: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
targets_url: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
target: null,
|
|
|
|
targets: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
Select
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
$(this.$refs.modal).modal('show');
|
|
|
|
$(this.$refs.modal).on('hidden.bs.modal', () => {
|
|
|
|
this.$emit('cancel');
|
|
|
|
});
|
|
|
|
this.fetchTargets();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
setTarget(target) {
|
|
|
|
this.target = target;
|
|
|
|
},
|
|
|
|
fetchTargets() {
|
|
|
|
axios.get(this.targets_url)
|
|
|
|
.then(response => {
|
|
|
|
this.targets = response.data.targets;
|
|
|
|
})
|
|
|
|
},
|
|
|
|
confirm() {
|
|
|
|
$(this.$refs.modal).modal('hide');
|
|
|
|
this.$emit('confirm', this.target);
|
|
|
|
},
|
|
|
|
cancel() {
|
|
|
|
$(this.$refs.modal).modal('hide');
|
2023-09-01 17:37:48 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
targetOptions() {
|
|
|
|
return this.targets.map(target => [
|
|
|
|
target[0],
|
|
|
|
target[1] || this.i18n.t('protocols.steps.modals.move_element.result.untitled_result'),
|
|
|
|
target[1] === null ? true : false
|
|
|
|
]);
|
2023-08-21 15:22:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|