update item & package & label & cycle

This commit is contained in:
Fayyazi
2019-10-30 14:19:47 +03:30
parent dbd0ddc1d4
commit da3dd22ec5
19 changed files with 292 additions and 109 deletions
+46 -13
View File
@@ -34,7 +34,7 @@
class="py-3 pr-3"
></v-text-field>
</v-flex>
<v-flex xs12 sm6 md1 class="WM-FlexCenter">
<v-flex xs12 sm6 md4 class="WM-FlexCenter">
<v-icon class="far fa-calendar-alt mr-2"></v-icon>
<v-menu
lazy
@@ -59,17 +59,37 @@
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs12 sm6 md8 class="WM-FlexCenter pl-3">
<v-flex xs12 sm6 md4 class="WM-FlexCenter pl-3" style="position: relative" v-for="(label, key) in formData.labels" :key="key">
<v-icon class="fa fa-check mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete
multiple
color="black"
:items="packs"
:items="labels"
item-text="name"
item-value="id"
v-model="formData.packs"
label="Select Labels For Cycle"
v-model="label.id"
label="Select Label For Cycle"
></v-autocomplete>
<v-btn
absolute
small
right
bottom
color="cyan"
@click="duplicateForm(key)"
>
<v-icon class="white--text mr-2 caption">fas fa-plus</v-icon>ADD
</v-btn>
<v-btn v-if="key > 0"
absolute
small
left
bottom
color="red"
@click="removeForm(key)"
>
<v-icon class="white--text mr-2 caption">fas fa-remove</v-icon>REMOVE
</v-btn>
</v-flex>
<v-spacer></v-spacer>
<v-flex xs12 sm12 md12 class="WM-FlexCenter">
@@ -117,9 +137,13 @@ export default {
formData: {
name: "",
note: "",
packs: []
labels: [
{
name:''
}
]
},
packs: [],
labels: [],
rules: {
required: value => !!value || "Required.",
counter: value =>
@@ -134,7 +158,7 @@ export default {
if (this.$route.params.cycle) {
this.load(this.$route.params.cycle);
}
this.loadPacks();
this.loadLabels();
},
methods: {
async load(id) {
@@ -143,10 +167,10 @@ export default {
this.formData = result.data.data;
}
},
async loadPacks() {
const result = await ApiService.get(urls.listAllPack());
async loadLabels() {
const result = await ApiService.get(urls.listAllLabel());
if (result.status == 200) {
this.packs = result.data.data;
this.labels = result.data.data;
}
},
async submitForm() {
@@ -166,7 +190,16 @@ export default {
if (result && result.status == 200) {
this.$router.push({ name: "AllCycle" });
}
}
},
duplicateForm(infoIndex) {
this.formData.labels.push({
name: "",
});
},
removeForm(infoIndex) {
this.formData.labels.splice(infoIndex, 1);
},
}
};
</script>
+14 -1
View File
@@ -94,6 +94,10 @@
<v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<span>Remove</span>
</v-btn>
<v-btn color="orange darken-1" @click="generateBarcode(item.id)">
<v-icon class="white--text mr-1 caption">fas fa-barcode</v-icon>
<span>Generate Barcode</span>
</v-btn>
</td>
</template>
</v-data-table>
@@ -220,7 +224,16 @@ export default {
}
}
}
}
},
async generateBarcode(code) {
const result = await ApiService.post(urls.Barcode(code));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
properties: { result }
});
}
}
},
computed: {
...mapGetters("modal", ["getModalResult"])
+1 -1
View File
@@ -38,7 +38,7 @@
>
<v-icon class="white--text mr-2 caption">fas fa-plus</v-icon>ADD
</v-btn>
<v-btn
<v-btn v-if="key > 0"
absolute
small
left