fix : duplicate in package & cycle- show items details

This commit is contained in:
zeinab.ashrafi
2025-04-19 11:39:46 +03:30
parent b599301477
commit 69e44905ff
4 changed files with 135 additions and 30 deletions
+14 -2
View File
@@ -23,7 +23,7 @@
</v-flex>
<v-flex xs12 sm6 md4 class="WM-FlexCenter">
<v-icon class="far fa-calendar-alt mr-2"/>
<v-menu
<v-menu class="WM-Width-Full"
lazy
:close-on-content-click="true"
transition="v-scale-transition"
@@ -48,6 +48,9 @@
<div class="Inner">
<v-icon class="fa fa-check mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete
@keydown.enter.native.prevent="duplicateForm(key)"
@change="duplicateForm(key)"
:ref="`selectItem-${key}`"
color="black"
:items="labels"
item-text="id"
@@ -132,6 +135,7 @@ export default {
},
created() {
this.loadLabels();
console.log()
if (this.$route.params.cycle) {
this.load(this.$route.params.cycle);
}
@@ -159,6 +163,7 @@ export default {
}
},
async submitForm() {
this.formData.labels = this.formData.labels.filter(label => label.id);
let result;
if (this.$route.params.cycle) {
result = await ApiService.put(urls.updateCycle(this.$route.params.cycle), this.formData);
@@ -170,8 +175,15 @@ export default {
this.$router.push({name: "AllCycle"});
}
},
duplicateForm(infoIndex) {
duplicateForm() {
this.formData.labels.push({name: "",});
this.$nextTick( () => {
const newIndex = this.formData.labels.length - 1;
const ref = this.$refs[`selectItem-${newIndex}`];
if (ref && ref[0]) {
ref[0].focus();
}
});
},
removeForm(infoIndex) {
this.formData.labels.splice(infoIndex, 1);
+8 -2
View File
@@ -199,9 +199,15 @@ export default {
}
},
duplicateForm(infoIndex) {
duplicateForm() {
this.formData.items.push({name: "",});
this.$refs[`selectItem-${infoIndex}`][0].focus();
this.$nextTick( () => {
const newIndex = this.formData.items.length - 1;
const ref = this.$refs[`selectItem-${newIndex}`];
if (ref && ref[0]) {
ref[0].focus();
}
});
},
removeForm(infoIndex) {
this.formData.items.splice(infoIndex, 1);