2023-12-01 07:01:08 +08:00
|
|
|
<template>
|
|
|
|
<div ref="modal" class="modal" tabindex="-1" role="dialog">
|
|
|
|
<div class="modal-dialog" role="document">
|
2024-02-27 20:03:41 +08:00
|
|
|
<form @submit.prevent="submit">
|
|
|
|
<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 truncate !block" id="edit-project-modal-label" :title="folder.name">
|
|
|
|
{{ i18n.t('projects.index.modal_edit_folder.title', {folder: folder.name}) }}
|
|
|
|
</h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<div class="mb-6">
|
|
|
|
<label class="sci-label">{{ i18n.t("projects.index.modal_edit_folder.folder_name_field") }}</label>
|
|
|
|
<div class="sci-input-container-v2" :class="{'error': error}" :data-error="error">
|
|
|
|
<input type="text" v-model="name"
|
|
|
|
class="sci-input-field" autofocus="true" ref="input"
|
|
|
|
:placeholder="i18n.t('projects.index.modal_new_project.name_placeholder')" />
|
|
|
|
</div>
|
2023-12-01 07:01:08 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-02-27 20:03:41 +08:00
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ i18n.t('general.cancel') }}</button>
|
|
|
|
<button class="btn btn-primary" type="submit">
|
|
|
|
{{ i18n.t('projects.index.modal_edit_folder.submit') }}
|
|
|
|
</button>
|
|
|
|
</div>
|
2023-12-01 07:01:08 +08:00
|
|
|
</div>
|
2024-02-27 20:03:41 +08:00
|
|
|
</form>
|
2023-12-01 07:01:08 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
2023-12-11 16:18:22 +08:00
|
|
|
import SelectDropdown from '../../shared/select_dropdown.vue';
|
2023-12-01 07:01:08 +08:00
|
|
|
import axios from '../../../packs/custom_axios.js';
|
2023-12-11 16:18:22 +08:00
|
|
|
import modalMixin from '../../shared/modal_mixin';
|
2023-12-01 07:01:08 +08:00
|
|
|
|
|
|
|
export default {
|
2023-12-11 16:18:22 +08:00
|
|
|
name: 'EditFolderModal',
|
2023-12-01 07:01:08 +08:00
|
|
|
props: {
|
|
|
|
folder: Object,
|
|
|
|
},
|
2023-12-11 16:18:22 +08:00
|
|
|
mixins: [modalMixin],
|
2023-12-01 07:01:08 +08:00
|
|
|
components: {
|
|
|
|
SelectDropdown,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
name: this.folder.name,
|
|
|
|
error: null,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submit() {
|
|
|
|
axios.put(this.folder.urls.update, {
|
|
|
|
project_folder: {
|
|
|
|
name: this.name,
|
2023-12-11 16:18:22 +08:00
|
|
|
},
|
2023-12-01 07:01:08 +08:00
|
|
|
}).then(() => {
|
|
|
|
this.error = null;
|
|
|
|
this.$emit('update');
|
|
|
|
}).catch((error) => {
|
|
|
|
this.error = error.response.data.errors.name;
|
2023-12-11 16:18:22 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2023-12-01 07:01:08 +08:00
|
|
|
</script>
|